{% extends "layout.html" %}
{% block title %} VPN Site-to-Site 修改隧道{% endblock %}

{% block trail %}
        <li><a href="/">Home</a></li>
        <li><a href="{{ url_for('sts.index') }}">VPN</a></li>
        <li class="current"><a href="{{ url_for('sts.index') }}">Site-to-Site</a></li>
{% endblock trail %}

{% block content %}
    {% include "sts/sidenav.html" %}

    <!-- start of sts vpn table -->
    <div class="large-10 columns">
      {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
      {% for category, message in messages %}
      <div data-alert class="alert-box {{ category }}">
        {{ message }}
        <a href="#" class="close">&times;</a>
      </div>
      {% endfor %}
      {% endif %}
      {% endwith %}
      <form method="POST" action="{{ url_for('sts.settings', id=tunnel.id) }}">
        <div class="row">
          <div class="large-3 columns">
            {{ form.tunnel_name.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.tunnel_name.errors %}
            {{ form.tunnel_name(class="error", value=form.tunnel_name.value) }}
            <small class="error">{{ form.tunnel_name.errors[0] }}</small>
            {% else %}
            {{ form.tunnel_name(value=tunnel.name) }}
            {% endif %}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.start_type.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.start_type }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.ike_encryption_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.ike_encryption_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.ike_integrity_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.ike_integrity_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.ike_dh_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.ike_dh_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.esp_encryption_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.esp_encryption_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.esp_integrity_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.esp_integrity_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.esp_dh_algorithm.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {{ form.esp_dh_algorithm }}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.local_subnet.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.local_subnet.errors %}
            {{ form.local_subnet(class="error") }}
            <small class="error">{{ form.local_subnet.errors[0] }}</small>
            {% else %}
            {{ form.local_subnet }}
            {% endif %}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.remote_ip.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.remote_ip.errors %}
            {{ form.remote_ip(class="error", value=form.remote_ip.value) }}
            <small class="error">{{ form.remote_ip.errors[0] }}</small>
            {% else %}
            {{ form.remote_ip(value=tunnel.rules.right) }}
            {% endif %}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.remote_subnet.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.remote_subnet.errors %}
            {{ form.remote_subnet(class="error") }}
            <small class="error">{{ form.remote_subnet.errors[0] }}</small>
            {% else %}
            {{ form.remote_subnet }}
            {% endif %}
          </div>
        </div>
        <div class="row">
          <div class="large-3 columns">
            {{ form.psk.label(class="right inline") }}
          </div>
          <div class="large-5 columns end">
            {% if form.psk.errors %}
            {{ form.psk(class="error", value=form.psk.value) }}
            <small class="error">{{ form.psk.errors[0] }}</small>
            {% else %}
            {{ form.psk(value=tunnel.psk) }}
            {% endif %}
          </div>
        </div>

        <div class="row">
          <div class="large-3 columns large-offset-3">
            {{ form.save(class="success tiny button") }}
          </div>
          <div class="large-2 columns end">
            {{ form.delete(class="alert tiny button") }}
          </div>
          <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
        </div>
      </form>
    </div>
    <!-- end of sts vpn table -->
{% endblock content %}
